﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using IveelySE.BigData.MasterNode;
using IveelySE.BigData.Common;

namespace IveelySE.BigData.StoreNode
{
    class Program
    {
        /// <summary>
        /// 配置信息
        /// </summary>
        public static Config Config = new Config();

        /// <summary>
        /// 上线线程
        /// </summary>
        private static Thread OnLine { get; set; }
        /// <summary>
        /// 插入数据线程
        /// </summary>
        private static Thread Insert { get; set; }
        /// <summary>
        /// 读取数据线程
        /// </summary>
        private static Thread Read { get; set; }

        static void Main(string[] args)
        {
            //向服务器上线请求线程
            OnLine = new Thread(new ThreadStart(Online));
            //启动线程
            OnLine.Start();
            //插入数据线程
            Insert = new Thread(new ThreadStart(InsertData));
            //启动线程
            Insert.Start();
            //读取数据线程
            Read = new Thread(new ThreadStart(ReadData));
            //启动线程
            Read.Start();
        }

        /// <summary>
        /// 上线发送上线消息
        /// </summary>
        private static void Online()
        {
            //登录到服务器
            DataService.Login();
        }

        /// <summary>
        /// 获取客户端数据，执行插入
        /// </summary>
        private static void InsertData()
        {
            //数据插入服务
            DataService.Insert();
        }

        /// <summary>
        /// 读取数据服务
        /// </summary>
        private static void ReadData()
        {
            DataService.Read();
        }




        
    }
}
